<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/jsp/commons/taglibs.jsp"%>
<!DOCTYPE html >
<html>
<head>
</head>
<body>

	<table width="100%" border="0" cellspacing="0" cellpadding="0"
		class="tab">
		<tr>
			<th width="5%">序号</th>
			<th width="10%">日期</th>
			<th width="10%">客户名称</th>
			<th width="10%">甲方负责人</th>
			<th width="10%">联系电话</th>
			<th width="10%">业务员</th>
			<th width="10%">任务</th>
			<th width="10%">跟进情况</th>
			<th width="10%">结果状态</th>
			<th width="15%">操作</th>
		</tr>
		<c:if test="${empty resultDto.result  }">
		<tr>
			<td colspan="10">没有记录</td>
		</tr>
		</c:if>
		
		<c:forEach items="${resultDto.result}" var="result" varStatus="sn">
			<tr>
				<td>${sn.index+1 }</td>
				<td><fmt:formatDate value="${result.createDate}"
						pattern="yyyy年MM月dd日" /></td>
				<td title="${result.customerName}">
				<c:choose>
				<c:when test="${fn:length(result.customerName)>10}">${fn:substring(result.customerName, 0, 10)}...</c:when>
				<c:otherwise>${result.customerName}</c:otherwise>
				</c:choose>
				</td>
				<td title="${result.contactName}">${result.contactName}</td>
				<td title="${result.mobileNum}">${result.mobileNum}</td>
				<td title="${result.businessManName}">${result.businessManName}</td>
				<td title="${result.duty}">
				<c:choose>
				<c:when test="${fn:length(result.duty)>10}">${fn:substring(result.duty, 0, 10)}...</c:when>
				<c:otherwise>${result.duty}</c:otherwise>
				</c:choose>
				</td>
				<td title="${result.progress}">
				<c:choose>
				<c:when test="${fn:length(result.progress)>10}">${fn:substring(result.progress, 0, 10)}...</c:when>
				<c:otherwise>${result.progress}</c:otherwise>
				</c:choose>
				</td>
				<td  >
				<c:choose>
				<c:when test="${result.result eq '0'}">正在跟进</c:when>
				<c:when test="${result.result eq '1' && projectType eq '0' }">已转业务订单</c:when>
				<c:when test="${result.result eq '1' && projectType eq '1' }">已转设计订单</c:when>
				<c:when test="${result.result eq '2'}">取消</c:when>
				</c:choose>
				</td>
				 
				<td title="">
				<c:choose>
					<c:when test="${actionType eq '6'}">
					<a href="#" onclick="processNotice('${result.businessInfoId}')">处理 </a> &nbsp;&nbsp;
					</c:when>
					<c:otherwise>
					<a href="${ctx }/business/businessInfoAction!updateInit.action?businessInfo.businessInfoId=${result.businessInfoId}">编辑 </a> |
					 <c:choose>
				     <c:when test="${projectType eq '0' }">
				        <a href="#" onclick="toBusinessOrder('${result.businessInfoId}')">转业务订单 </a> |
				     </c:when>
				     <c:when test="${projectType eq '1' }">
				        <a href="#" onclick="toDesignOrder('${result.businessInfoId}')">转设计订单 </a> |
				     </c:when>
				     </c:choose>   
					<a href="#" onclick="removeBusinessInfo('${result.businessInfoId}')">删除 </a> 
					</c:otherwise>
				</c:choose> 
				</td>
			</tr>
		</c:forEach>
	</table>
	<s:if test="resultDto.result!=null && resultDto.result.size()>0">
	<!--分页 begin-->
	<div class="pageleft">共有${resultDto.pagination.total}条数据，当前第${resultDto.pagination.index+1}页</div>
	<%-- 	<div class="pageleft">
		共有${resultDto.pagination.total }条数据，当前第<span id="pageCodeId"></span>页
	</div> --%>
		<c:choose>
			<c:when test="${actionType eq '6'}">
				<div class="pagenum">
					<a href="#" id="topPage"
						onclick="queryPageByCon('${ctx}/business/businessInfoAction!toCenterList.action',0,'noticeResult');">首页</a>
					<span id="Paginationa"></span> <a href="#" id="endPage"
						onclick="queryPageByCon('${ctx}/business/businessInfoAction!toCenterList.action','${totalPage-1 }','noticeResult');">尾页</a>
				</div>
			</c:when>
			<c:otherwise>
				<div class="pagenum">
				     <c:choose>
				     <c:when test="${projectType eq '0' }">
				        <a href="#" id="topPage"
						onclick="queryPage('${ctx}/business/businessInfoAction!list.action',0);">首页</a>
					<span id="Paginationa"></span> <a href="#" id="endPage"
						onclick="queryPage('${ctx}/business/businessInfoAction!list.action','${totalPage-1 }');">尾页</a>
				     </c:when>
				     <c:when test="${projectType eq '1' }">
				        <a href="#" id="topPage"
						onclick="queryPage('${ctx}/business/businessInfoAction!listCommerce.action',0);">首页</a>
					<span id="Paginationa"></span> <a href="#" id="endPage"
						onclick="queryPage('${ctx}/business/businessInfoAction!listCommerce.action','${totalPage-1 }');">尾页</a>
				     </c:when>
				     </c:choose>   
					
				</div>
			</c:otherwise>
		</c:choose>

		<input type="hidden" id="totalRow"
			value="${resultDto.pagination.total }" />
		<input type="hidden" id="totalPage" value="${totalPage }" />
		<div class="clear"></div>
	</s:if>
	<div id="projectNameDiv" style="display: none;">
	<dl class="clearfix">
		<dt style="display: none;">基本信息</dt>
		<dd>
			<label class="name">项目名称：</label><span class="toname"> 
		     <input type="text" value="" id="dialog_business_name" value="" name="businessInfo.businessName" title="项目名称" class="winput3" />
			</span>
			<div class="fl">
				<em id="customerNameTip"></em>
			</div>
		</dd>
		<dd>
			<label class="name">项目编码：</label><span class="toname"> 
		     <input type="text" value="" id="dialog_business_code" value="" name="businessInfo.code" title="项目编码" class="winput3" />
			</span>
			<div class="fl">
				<em id="customerNameTip"></em>
			</div>
		</dd>
    </dl>
	</div>
</body>
<script type="text/javascript">
//转业务订单toBusinessOrder(
function toBusinessOrder(workSystemId){
	art.dialog.confirm('你确认转业务订单 ', function(){
		//显示项目名称弹出层
		art.dialog({
				    id: 'projectArtDialog',
				    title: '填写项目名称',
				    content: $("#projectNameDiv").html(),//绑定内容
				    button: [
				             {
				                 name: '完成',
				                 callback: function () {
				                	 //判断项目名称是否为空
				                	 var businessName=$("#dialog_business_name").val();
				                	 if(businessName==""){
				                		 art.dialog.tips('请填写项目名称！', 1.5);
				                		 return false;
				                	 }else{
				                		//修改提醒处理状态
					                	 $.post("${ctx}/business/businessInfoAction!shiftBusinessOrder.action", {
					             			random : Math.random(),
					             			"businessInfo.businessInfoId" : workSystemId,
					             			"businessInfo.businessName" : businessName
					             		}, function(data) {
					             			var jsonData = strToJson(data);
					             			if (jsonData.flag == "success") {
					             				art.dialog.tips('操作成功！', 1.5);
					             				window.location.href = "${ctx}/business/businessInfoAction!listInit.action";
					             			} else {
					             				art.dialog.tips('操作失败，请联系管理员！', 1.5); 
					             			}
					             		});
				                	 }
									
				                 },
				                 focus: true
				             },
				             {
				                 name: '关闭' 
				             } 
				         ]
				});
	}, function(){
	     
	});
}		
//删除业务信息
function removeBusinessInfo(workSystemId){
	art.dialog.confirm('你确认删除操作 ', function(){
		$.post("${ctx}/business/businessInfoAction!delete.action", {
			random : Math.random(),
			"businessInfo.businessInfoId" : workSystemId
		}, function(data) {
			var jsonData = strToJson(data);
			if (jsonData.flag == "success") {
				art.dialog.tips('操作成功！', 1.5);
				window.location.href = "${ctx}/business/businessInfoAction!listInit.action";
			} else {
				art.dialog.tips('操作失败，请联系管理员！', 1.5); 
			}
		});
	}, function(){
	     
	});
}
</script>
</html>
